I want to import ckeditor5 in my React project.
I reference official description from link here.
First, I execute installation as below:
npm install --save @ckeditor/ckeditor5-react @ckeditor/ckeditor5-build-classic
After installation, I tried to execute my project as below:
npm start
Then, I got errors:
ERROR in ./~/@ckeditor/ckeditor5-react/dist/ckeditor.js Module parse failed: C:\work_project\node_modules@ckeditor\ckeditor5-react\dist\ckeditor.js Unexpected token (5:29505) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (5:29505) at Parser.pp$4.raise (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp$3.parseIdent (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:2189:12) at Parser.pp$3.parsePropertyName (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:2052:101) at Parser.pp$3.parseObj (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1988:14) at Parser.pp$3.parseExprAtom (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1805:19) at Parser.pp$3.parseExprSubscripts (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1715:21) at Parser.pp$3.parseMaybeUnary (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1692:19) at Parser.pp$3.parseExprOps (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1637:21) at Parser.pp$3.parseMaybeConditional (C:\work_project\node_modules\webpack\node_modules\acorn\dist\acorn.js:1620:21)
The following is my webpack.config.js:
module.exports = {
entry: ["./src/index.js"],
output: {
path: __dirname,
publicPath: "/",
filename: "bundle.js"
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.css$/, loader: "css-loader" },
{
exclude: /node_modules/,
loader: "babel",
query: {
presets: ["react", "es2015", "stage-1"]
}
}
]
},
resolve: {
extensions: ["", ".js", ".jsx"]
},
devServer: {
disableHostCheck: true, // That solved it
historyApiFallback: true,
contentBase: "./"
},
};
I don't know why I get these errors. Can you help me solve this problem? Thank you!